package org.qianji.goosql.dql.clause;

import org.qianji.goosql.cond.Condition;
import org.qianji.goosql.dql.Join;
import org.qianji.goosql.table.Table;

/**
 * 抽象From子句，主要实现了几个关联方法。
 * 
 * @author gmz
 * 
 */
public abstract class AbstractFrom implements From {

	/**
	 * 
	 */
	private static final long serialVersionUID = -774873552367430285L;

	@Override
	public From innerJoin(Table table, Condition cond) {
		return this.join(table, cond, Join.INNER);
	}

	@Override
	public From leftJoin(Table table, Condition cond) {
		return this.join(table, cond, Join.LEFT);
	}

	@Override
	public From rightJoin(Table table, Condition cond) {
		return this.join(table, cond, Join.RIGHT);
	}

	@Override
	public From fullJoin(Table table, Condition cond) {
		return this.join(table, cond, Join.FULL);
	}

	@Override
	public From join(Table table, Condition cond, Join join) {
		return new JoinedFrom(this, join, table, cond);
	}

}
